﻿using YiJingFramework.Core;
using YiJingFramework.Painting.Deriving.Extensions;
using YiJingFramework.Painting.Presenting;
using YiJingFramework.References.Zhouyi;

var converter = new CharacterConverter();
var zhouyi = new Zhouyi("translation.json");

Console.OutputEncoding = System.Text.Encoding.UTF8;

var paddingChar = '　';
for (int i = 1; i <= 64; i++)
{
    var hexagram = zhouyi.GetHexagram(i);
    var upper = hexagram.UpperTrigram;
    var lower = hexagram.LowerTrigram;

    Console.Write($"第 {i:00} 卦{paddingChar}" +
            $"上{upper.Name}{converter.ConvertTo(upper.GetPainting())}" +
            $"下{lower.Name}{converter.ConvertTo(lower.GetPainting())}{paddingChar}");

    if (upper == lower)
        Console.WriteLine(
            $"{hexagram.Name}{converter.ConvertTo(hexagram.GetPainting())}为{upper.Nature}");
    else
        Console.WriteLine(
            $"{upper.Nature}{lower.Nature}{hexagram.Name}{converter.ConvertTo(hexagram.GetPainting())}");
}